<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();  
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>设备故障日志</title>
	
	<link rel="stylesheet" href="scripts/bootstrap/css/bootstrap.min.css" />
	<script src="scripts/jquery-3.1.1.min.js" type="text/javascript"></script>
	<script src="scripts/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
</head>

<body>
	<div style="width:100%;">
	<h2>日志</h2>
	<table class="table	table-bordered">
		<thead>
			<tr>
				<th>序号</th>
				<th>设备编号</th>
				<th>故障开始时间</th>
				<th>故障结束时间</th>
				<th>故障时间(h)</th>
			</tr>
		</thead>
		<tbody>
			<tbody>				
				<c:if test="${list == null}">
				<tr>
	                <td colspan="12"><p style="text-align:center;">没有设备故障日志！！！</p></td>
	            </tr>
				</c:if>
				<c:if test="${list != null}">
				<%  int num = (Integer)request.getAttribute("currPage");
	    			int i= (num-1)*5; %>
				<c:forEach items="${list}" var="item"> 
				<tr> 
					<% i++; %>
	    			<td><%= i %></td>
					<td>${item.num}</td>
					<td>${item.begintime}</td>
					<td>${item.endtime}</td>
					<td>${item.hour}</td>
				</tr>
				</c:forEach>
				</c:if>
			</tbody>
			<tfoot>
	            <tr>
	                <td colspan="5">
	                <div class="pagination">
	    			<a href="javascript:void(0);" onclick="device_log(1)">第一页</a>
	    			<a href="javascript:void(0);" onclick="device_log(${currPage-1})">上一页</a>
	    			<a href="javascript:void(0);" onclick="device_log(${currPage+1})">下一页</a>
	    			<a href="javascript:void(0);" onclick="device_log(${totalPage})">最末页</a>
	    			${currPage}/${totalPage}页,共${totalRows}个项目
	    			</div>
	    			</td>
	            </tr>
	        </tfoot>
		</tbody>
	</table>
	</div>
</body>
</html>